package com.awanp3.nimbus.remote.service;

import com.awanp3.nimbus.common.core.exception.ServiceException;
import com.awanp3.nimbus.common.core.utils.StringUtils;
import com.awanp3.nimbus.remote.api.RWmsPoInfoService;
import com.awanp3.nimbus.remote.api.domain.RemoteWmsPoInfo;
import com.awanp3.nimbus.remote.api.model.FetchOrderParam;
import com.awanp3.nimbus.remote.context.WmsPoInfoContext;
import lombok.RequiredArgsConstructor;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author 20014170
 */
@RequiredArgsConstructor
@Service
@DubboService
public class WmsPoInfoServiceImpl implements RWmsPoInfoService {

    private final WmsPoInfoContext wmsPoInfoContext;


    @Override
    public List<RemoteWmsPoInfo> fetch(FetchOrderParam param) {
        if (StringUtils.isEmpty(param.getCompanyCode())) {
            throw new ServiceException("必须需要传入公司编码。");
        }
        return wmsPoInfoContext.fetch(param);
    }
}
